Class symantec.itools.awt.util.spinner.ListSpinner
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class symantec.itools.awt.util.spinner.ListSpinner

Object
   |
   +----Component
           |
           +----Container
                   |
                   +----Panel
                           |
                           +----Spinner
                                   |
                                   +----symantec.itools.awt.util.spinner.ListSpinner

public class ListSpinner
extends Spinner
Creates a text box, containing a list of items, with up and down arrows. Use this component to allow your users to move through a set of fixed values or type a valid value in the box.

At run time only the selected value is displayed in the text box.

Version:
1.1, October 1, 1997
Author:
Symantec
See Also:
Spinner

Variable Index

 o dynamicResizing
Flag to keep track of allowance of dynamic resizing of the edit box as new values are entered.
 o internalMax
The maximum value the list is allowed to go to.
 o isPossibleEdit
Is possible to edit the component.
 o list
The list of strings that get displayed in the spinner.
 o oldText
Text value at the time focus was gained.

Constructor Index

 o symantec.itools.awt.util.spinner.ListSpinner()
Constructs an empty ListSpinner.

Method Index

 o addItem(String)
Adds a string to the end of the list.
 o addMaxListener(PropertyChangeListener)
Adds a listener for the max property changes.
 o addMaxListener(VetoableChangeListener)
Adds a vetoable listener for the max property changes.
 o addNotify()
Tells this component that it has been added to a container.
 o addPropertyChangeListener(PropertyChangeListener)
Adds a listener for all property change events.
 o addVetoableChangeListener(VetoableChangeListener)
Adds a listener for all vetoable property change events.
 o getCurrentText()
Gets the currently selected string from the list.
 o getListItems()
Returns the current list as an array of Strings.
 o isAllowDynamicResizing()
Gets whether the current value can wrap around from maximum to minimum and from minimum to maximum.
 o isValidCurrentValue(int)
Is the given value valid for the Current property .
 o isValidMaxValue(int)
Is the given value valid for the Max property .
 o isValidMinValue(int)
Is the given value valid for the Min property .
 o removeMaxListener(PropertyChangeListener)
Removes a listener for the max property changes.
 o removeMaxListener(VetoableChangeListener)
Removes a vetoable listener for the max property changes.
 o removeNotify()
Tells this component that it is being removed from a container.
 o removePropertyChangeListener(PropertyChangeListener)
Removes a listener for all property change events.
 o removeVetoableChangeListener(VetoableChangeListener)
Removes a listener for all vetoable property change events.
 o scrollDown()
Decrements the spinner's value and handles wrapping as needed.
 o scrollUp()
Increments the spinner's value and handles wrapping as needed.
 o setAllowDynamicResizing(boolean)
Conditionally allows resizing of the edit box if needed when new values are entered.
 o setListItems(String[])
Adds the given string array to the end of the list.
 o setMax(int)
Sets the maximum value the spinner may have.
 o truncateContents(String)
Gets the current contets and truncates the string appropriately.
 o updateButtonStatus()
Handles enabling or disabling the spinner buttons as needed.
 o updateInternalMax()
Keeps track of the maximum value the list is allowed to go to.
 o updateText(boolean)
Updates the text field with the current text, as needed or depending on the force flag.

Variables

 o dynamicResizing
protected boolean dynamicResizing
Flag to keep track of allowance of dynamic resizing of the edit box as new values are entered.

 o internalMax
protected int internalMax
The maximum value the list is allowed to go to.

 o isPossibleEdit
protected boolean isPossibleEdit
Is possible to edit the component. True when it has the focus.

 o list
protected java.util.Vector list
The list of strings that get displayed in the spinner.

 o oldText
protected java.lang.String oldText
Text value at the time focus was gained.

Constructors

 o ListSpinner
public ListSpinner()
Constructs an empty ListSpinner.

Methods

 o addItem
public void addItem(String s)
Adds a string to the end of the list.

Parameters:
s - the string to be appended to the list
See Also:
setListItems
 o addMaxListener
public synchronized void addMaxListener(PropertyChangeListener listener)
Adds a listener for the max property changes.

Parameters:
listener - the listener to add.
Overrides:
addMaxListener in class Spinner
See Also:
removeMaxListener(java.beans.PropertyChangeListener)
 o addMaxListener
public synchronized void addMaxListener(VetoableChangeListener listener)
Adds a vetoable listener for the max property changes.

Parameters:
listener - the listener to add.
Overrides:
addMaxListener in class Spinner
See Also:
removeMaxListener(java.beans.VetoableChangeListener)
 o addNotify
public void addNotify()
Tells this component that it has been added to a container. This is a standard Java AWT method which gets called by the AWT when this component is added to a container. Typically, it is used to create this component's peer. Here it's used to get the length of the largest string in the list.

Overrides:
addNotify in class Spinner
See Also:
removeNotify
 o addPropertyChangeListener
public synchronized void addPropertyChangeListener(PropertyChangeListener listener)
Adds a listener for all property change events.

Parameters:
listener - the listener to add
Overrides:
addPropertyChangeListener in class Spinner
See Also:
removePropertyChangeListener
 o addVetoableChangeListener
public synchronized void addVetoableChangeListener(VetoableChangeListener listener)
Adds a listener for all vetoable property change events.

Parameters:
listener - the listener to add
Overrides:
addVetoableChangeListener in class Spinner
See Also:
removeVetoableChangeListener
 o getCurrentText
public java.lang.String getCurrentText()
Gets the currently selected string from the list.

Returns:
the string currently visible in the Spinner
Overrides:
getCurrentText in class Spinner
 o getListItems
public java.lang.String[] getListItems()
Returns the current list as an array of Strings.

Returns:
the current list
See Also:
setListItems
 o isAllowDynamicResizing
public boolean isAllowDynamicResizing()
Gets whether the current value can wrap around from maximum to minimum and from minimum to maximum.

Returns:
true if the edit box will resize if needed when new values are entered.
See Also:
setAllowDynamicResizing
 o isValidCurrentValue
protected boolean isValidCurrentValue(int i)
Is the given value valid for the Current property .

Parameters:
i - the given value
Returns:
true if the given value is acceptable, false if not.
Overrides:
isValidCurrentValue in class Spinner
 o isValidMaxValue
protected boolean isValidMaxValue(int i)
Is the given value valid for the Max property .

Parameters:
i - the given value
Returns:
true if the given value is acceptable, false if not.
Overrides:
isValidMaxValue in class Spinner
 o isValidMinValue
protected boolean isValidMinValue(int i)
Is the given value valid for the Min property .

Parameters:
i - the given value
Returns:
true if the given value is acceptable, false if not.
Overrides:
isValidMinValue in class Spinner
 o removeMaxListener
public synchronized void removeMaxListener(PropertyChangeListener listener)
Removes a listener for the max property changes.

Parameters:
listener - the listener to remove.
Overrides:
removeMaxListener in class Spinner
See Also:
addMaxListener(java.beans.PropertyChangeListener)
 o removeMaxListener
public synchronized void removeMaxListener(VetoableChangeListener listener)
Removes a vetoable listener for the max property changes.

Parameters:
listener - the listener to remove.
Overrides:
removeMaxListener in class Spinner
See Also:
addMaxListener(java.beans.VetoableChangeListener)
 o removeNotify
public synchronized void removeNotify()
Tells this component that it is being removed from a container. This is a standard Java AWT method which gets called by the AWT when this component is removed from a container. Typically, it is used to destroy the peers of this component and all its subcomponents. It has been overridden here to unhook event listeners.

Overrides:
removeNotify in class Spinner
See Also:
addNotify
 o removePropertyChangeListener
public synchronized void removePropertyChangeListener(PropertyChangeListener listener)
Removes a listener for all property change events.

Parameters:
listener - the listener to remove
Overrides:
removePropertyChangeListener in class Spinner
See Also:
addPropertyChangeListener
 o removeVetoableChangeListener
public synchronized void removeVetoableChangeListener(VetoableChangeListener listener)
Removes a listener for all vetoable property change events.

Parameters:
listener - the listener to remove
Overrides:
removeVetoableChangeListener in class Spinner
See Also:
addVetoableChangeListener
 o scrollDown
protected void scrollDown()
Decrements the spinner's value and handles wrapping as needed.

Overrides:
scrollDown in class Spinner
See Also:
scrollUp, increment
 o scrollUp
protected void scrollUp()
Increments the spinner's value and handles wrapping as needed.

Overrides:
scrollUp in class Spinner
See Also:
scrollDown, increment
 o setAllowDynamicResizing
public void setAllowDynamicResizing(boolean f) throws PropertyVetoException
Conditionally allows resizing of the edit box if needed when new values are entered.

Parameters:
f - if true the edit box will resize if needed when new values are entered.
Throws: PropertyVetoException
if the specified property value is unacceptable
See Also:
isAllowDynamicResizing
 o setListItems
public void setListItems(String[] items) throws PropertyVetoException
Adds the given string array to the end of the list.

Parameters:
items - the items to add to the list
Throws: PropertyVetoException
if the specified property value is unacceptable
See Also:
getListItems
 o setMax
public void setMax(int i) throws PropertyVetoException
Sets the maximum value the spinner may have.

Parameters:
i - the new maximum value
Throws: PropertyVetoException
if the specified property value is unacceptable
Overrides:
setMax in class Spinner
See Also:
getMax
 o truncateContents
protected java.lang.String truncateContents(String contents)
Gets the current contets and truncates the string appropriately. This assumes it is geting called from updateText

Parameters:
contents - the string to truncate as if it were to be placed in the textField
Returns:
The truncated string. This may not be truncated if it was not needed.
 o updateButtonStatus
protected void updateButtonStatus()
Handles enabling or disabling the spinner buttons as needed.

Overrides:
updateButtonStatus in class Spinner
 o updateInternalMax
protected void updateInternalMax()
Keeps track of the maximum value the list is allowed to go to.

 o updateText
protected void updateText(boolean force)
Updates the text field with the current text, as needed or depending on the force flag.

Overrides:
updateText in class Spinner

All Packages  Class Hierarchy  This Package  Previous  Next  Index